home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 50 72 6f 67 72 61 6d |\chapter|{Program|
|00000010| 20 73 74 72 75 63 74 75 | 72 65 7d 0a 5c 6c 61 62 | structu|re}.\lab|
|00000020| 65 6c 7b 70 72 6f 67 72 | 61 6d 63 68 61 70 74 65 |el{progr|amchapte|
|00000030| 72 7d 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 50 72 6f |r}..\sec|tion{Pro|
|00000040| 67 72 61 6d 73 7d 0a 0a | 41 20 53 63 68 65 6d 65 |grams}..|A Scheme|
|00000050| 20 70 72 6f 67 72 61 6d | 20 63 6f 6e 73 69 73 74 | program| consist|
|00000060| 73 20 6f 66 20 61 20 73 | 65 71 75 65 6e 63 65 20 |s of a s|equence |
|00000070| 6f 66 20 65 78 70 72 65 | 73 73 69 6f 6e 73 20 61 |of expre|ssions a|
|00000080| 6e 64 20 64 65 66 69 6e | 69 74 69 6f 6e 73 2e 0a |nd defin|itions..|
|00000090| 45 78 70 72 65 73 73 69 | 6f 6e 73 20 61 72 65 20 |Expressi|ons are |
|000000a0| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 63 68 61 |describe|d in cha|
|000000b0| 70 74 65 72 7e 5c 72 65 | 66 7b 65 78 70 72 65 73 |pter~\re|f{expres|
|000000c0| 73 69 6f 6e 63 68 61 70 | 74 65 72 7d 3b 0a 64 65 |sionchap|ter};.de|
|000000d0| 66 69 6e 69 74 69 6f 6e | 73 20 61 72 65 20 74 68 |finition|s are th|
|000000e0| 65 20 73 75 62 6a 65 63 | 74 20 6f 66 20 74 68 65 |e subjec|t of the|
|000000f0| 20 72 65 73 74 20 6f 66 | 20 74 68 65 20 70 72 65 | rest of| the pre|
|00000100| 73 65 6e 74 20 63 68 61 | 70 74 65 72 2e 0a 0a 50 |sent cha|pter...P|
|00000110| 72 6f 67 72 61 6d 73 20 | 61 72 65 20 74 79 70 69 |rograms |are typi|
|00000120| 63 61 6c 6c 79 20 73 74 | 6f 72 65 64 20 69 6e 20 |cally st|ored in |
|00000130| 66 69 6c 65 73 20 6f 72 | 20 65 6e 74 65 72 65 64 |files or| entered|
|00000140| 20 69 6e 74 65 72 61 63 | 74 69 76 65 6c 79 20 74 | interac|tively t|
|00000150| 6f 20 61 0a 72 75 6e 6e | 69 6e 67 20 53 63 68 65 |o a.runn|ing Sche|
|00000160| 6d 65 20 73 79 73 74 65 | 6d 2c 20 61 6c 74 68 6f |me syste|m, altho|
|00000170| 75 67 68 20 6f 74 68 65 | 72 20 70 61 72 61 64 69 |ugh othe|r paradi|
|00000180| 67 6d 73 20 61 72 65 20 | 70 6f 73 73 69 62 6c 65 |gms are |possible|
|00000190| 3b 0a 71 75 65 73 74 69 | 6f 6e 73 20 6f 66 20 75 |;.questi|ons of u|
|000001a0| 73 65 72 20 69 6e 74 65 | 72 66 61 63 65 20 6c 69 |ser inte|rface li|
|000001b0| 65 20 6f 75 74 73 69 64 | 65 20 74 68 65 20 73 63 |e outsid|e the sc|
|000001c0| 6f 70 65 20 6f 66 20 74 | 68 69 73 20 72 65 70 6f |ope of t|his repo|
|000001d0| 72 74 2e 0a 28 49 6e 64 | 65 65 64 2c 20 53 63 68 |rt..(Ind|eed, Sch|
|000001e0| 65 6d 65 20 77 6f 75 6c | 64 20 73 74 69 6c 6c 20 |eme woul|d still |
|000001f0| 62 65 20 75 73 65 66 75 | 6c 20 61 73 20 61 20 6e |be usefu|l as a n|
|00000200| 6f 74 61 74 69 6f 6e 20 | 66 6f 72 20 65 78 70 72 |otation |for expr|
|00000210| 65 73 73 69 6e 67 0a 63 | 6f 6d 70 75 74 61 74 69 |essing.c|omputati|
|00000220| 6f 6e 61 6c 20 6d 65 74 | 68 6f 64 73 20 65 76 65 |onal met|hods eve|
|00000230| 6e 20 69 6e 20 74 68 65 | 20 61 62 73 65 6e 63 65 |n in the| absence|
|00000240| 20 6f 66 20 61 20 6d 65 | 63 68 61 6e 69 63 61 6c | of a me|chanical|
|00000250| 0a 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 2e |.impleme|ntation.|
|00000260| 29 0a 0a 44 65 66 69 6e | 69 74 69 6f 6e 73 20 6f |)..Defin|itions o|
|00000270| 63 63 75 72 72 69 6e 67 | 20 61 74 20 74 68 65 20 |ccurring| at the |
|00000280| 74 6f 70 20 6c 65 76 65 | 6c 20 6f 66 20 61 20 70 |top leve|l of a p|
|00000290| 72 6f 67 72 61 6d 20 63 | 61 6e 20 62 65 20 69 6e |rogram c|an be in|
|000002a0| 74 65 72 70 72 65 74 65 | 64 0a 64 65 63 6c 61 72 |terprete|d.declar|
|000002b0| 61 74 69 76 65 6c 79 2e | 20 20 54 68 65 79 20 63 |atively.| They c|
|000002c0| 61 75 73 65 20 62 69 6e | 64 69 6e 67 73 20 74 6f |ause bin|dings to|
|000002d0| 20 62 65 20 63 72 65 61 | 74 65 64 20 69 6e 20 74 | be crea|ted in t|
|000002e0| 68 65 20 74 6f 70 20 6c | 65 76 65 6c 0a 65 6e 76 |he top l|evel.env|
|000002f0| 69 72 6f 6e 6d 65 6e 74 | 2e 20 20 45 78 70 72 65 |ironment|. Expre|
|00000300| 73 73 69 6f 6e 73 20 6f | 63 63 75 72 72 69 6e 67 |ssions o|ccurring|
|00000310| 20 61 74 20 74 68 65 20 | 74 6f 70 20 6c 65 76 65 | at the |top leve|
|00000320| 6c 20 6f 66 20 61 20 70 | 72 6f 67 72 61 6d 20 61 |l of a p|rogram a|
|00000330| 72 65 0a 69 6e 74 65 72 | 70 72 65 74 65 64 20 69 |re.inter|preted i|
|00000340| 6d 70 65 72 61 74 69 76 | 65 6c 79 3b 20 74 68 65 |mperativ|ely; the|
|00000350| 79 20 61 72 65 20 65 78 | 65 63 75 74 65 64 20 69 |y are ex|ecuted i|
|00000360| 6e 20 6f 72 64 65 72 20 | 77 68 65 6e 20 74 68 65 |n order |when the|
|00000370| 20 70 72 6f 67 72 61 6d | 20 69 73 0a 69 6e 76 6f | program| is.invo|
|00000380| 6b 65 64 20 6f 72 20 6c | 6f 61 64 65 64 2c 20 61 |ked or l|oaded, a|
|00000390| 6e 64 20 74 79 70 69 63 | 61 6c 6c 79 20 70 65 72 |nd typic|ally per|
|000003a0| 66 6f 72 6d 20 73 6f 6d | 65 20 6b 69 6e 64 20 6f |form som|e kind o|
|000003b0| 66 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |f initia|lization|
|000003c0| 2e 0a 0a 5c 74 6f 64 6f | 7b 43 72 6f 6d 61 72 74 |...\todo|{Cromart|
|000003d0| 79 2c 20 65 74 63 2e 3a | 20 64 69 73 63 6c 61 69 |y, etc.:| disclai|
|000003e0| 6d 65 72 20 61 62 6f 75 | 74 20 74 6f 70 20 6c 65 |mer abou|t top le|
|000003f0| 76 65 6c 3f 7d 0a 0a 0a | 5c 73 65 63 74 69 6f 6e |vel?}...|\section|
|00000400| 7b 44 65 66 69 6e 69 74 | 69 6f 6e 73 7d 0a 0a 44 |{Definit|ions}..D|
|00000410| 65 66 69 6e 69 74 69 6f | 6e 73 20 61 72 65 20 76 |efinitio|ns are v|
|00000420| 61 6c 69 64 20 69 6e 20 | 73 6f 6d 65 2c 20 62 75 |alid in |some, bu|
|00000430| 74 20 6e 6f 74 20 61 6c | 6c 2c 20 63 6f 6e 74 65 |t not al|l, conte|
|00000440| 78 74 73 20 77 68 65 72 | 65 20 65 78 70 72 65 73 |xts wher|e expres|
|00000450| 73 69 6f 6e 73 0a 61 72 | 65 20 61 6c 6c 6f 77 65 |sions.ar|e allowe|
|00000460| 64 2e 20 20 54 68 65 79 | 20 61 72 65 20 76 61 6c |d. They| are val|
|00000470| 69 64 20 6f 6e 6c 79 20 | 61 74 20 74 68 65 20 74 |id only |at the t|
|00000480| 6f 70 20 6c 65 76 65 6c | 20 6f 66 20 61 20 5c 68 |op level| of a \h|
|00000490| 79 70 65 72 7b 70 72 6f | 67 72 61 6d 7d 0a 61 6e |yper{pro|gram}.an|
|000004a0| 64 2c 20 69 6e 20 73 6f | 6d 65 20 69 6d 70 6c 65 |d, in so|me imple|
|000004b0| 6d 65 6e 74 61 74 69 6f | 6e 73 2c 20 61 74 20 74 |mentatio|ns, at t|
|000004c0| 68 65 20 62 65 67 69 6e | 6e 69 6e 67 20 6f 66 20 |he begin|ning of |
|000004d0| 61 20 5c 68 79 70 65 72 | 7b 62 6f 64 79 7d 2e 0a |a \hyper|{body}..|
|000004e0| 5c 6d 61 69 6e 69 6e 64 | 65 78 7b 64 65 66 69 6e |\mainind|ex{defin|
|000004f0| 69 74 69 6f 6e 7d 0a 0a | 41 20 64 65 66 69 6e 69 |ition}..|A defini|
|00000500| 74 69 6f 6e 20 73 68 6f | 75 6c 64 20 68 61 76 65 |tion sho|uld have|
|00000510| 20 6f 6e 65 20 6f 66 20 | 74 68 65 20 66 6f 6c 6c | one of |the foll|
|00000520| 6f 77 69 6e 67 20 66 6f | 72 6d 73 3a 5c 6d 61 69 |owing fo|rms:\mai|
|00000530| 6e 73 63 68 69 6e 64 65 | 78 7b 64 65 66 69 6e 65 |nschinde|x{define|
|00000540| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 69 74 65 6d 69 7a |}..\begi|n{itemiz|
|00000550| 65 7d 0a 0a 5c 69 74 65 | 6d 20 7b 5c 74 74 28 64 |e}..\ite|m {\tt(d|
|00000560| 65 66 69 6e 65 20 5c 68 | 79 70 65 72 7b 76 61 72 |efine \h|yper{var|
|00000570| 69 61 62 6c 65 7d 20 5c | 68 79 70 65 72 7b 65 78 |iable} \|hyper{ex|
|00000580| 70 72 65 73 73 69 6f 6e | 7d 29 7d 0a 0a 54 68 69 |pression|})}..Thi|
|00000590| 73 20 73 79 6e 74 61 78 | 20 69 73 20 65 73 73 65 |s syntax| is esse|
|000005a0| 6e 74 69 61 6c 2e 0a 0a | 5c 69 74 65 6d 7b 5c 74 |ntial...|\item{\t|
|000005b0| 74 28 64 65 66 69 6e 65 | 20 28 5c 68 79 70 65 72 |t(define| (\hyper|
|000005c0| 7b 76 61 72 69 61 62 6c | 65 7d 20 5c 68 79 70 65 |{variabl|e} \hype|
|000005d0| 72 7b 66 6f 72 6d 61 6c | 73 7d 29 20 5c 68 79 70 |r{formal|s}) \hyp|
|000005e0| 65 72 7b 62 6f 64 79 7d | 29 7d 0a 0a 54 68 69 73 |er{body}|)}..This|
|000005f0| 20 73 79 6e 74 61 78 20 | 69 73 20 6e 6f 74 20 65 | syntax |is not e|
|00000600| 73 73 65 6e 74 69 61 6c | 2e 20 20 5c 68 79 70 65 |ssential|. \hype|
|00000610| 72 7b 46 6f 72 6d 61 6c | 73 7d 20 73 68 6f 75 6c |r{Formal|s} shoul|
|00000620| 64 20 62 65 20 65 69 74 | 68 65 72 20 61 0a 73 65 |d be eit|her a.se|
|00000630| 71 75 65 6e 63 65 20 6f | 66 20 7a 65 72 6f 20 6f |quence o|f zero o|
|00000640| 72 20 6d 6f 72 65 20 76 | 61 72 69 61 62 6c 65 73 |r more v|ariables|
|00000650| 2c 20 6f 72 20 61 20 73 | 65 71 75 65 6e 63 65 20 |, or a s|equence |
|00000660| 6f 66 20 6f 6e 65 20 6f | 72 20 6d 6f 72 65 0a 76 |of one o|r more.v|
|00000670| 61 72 69 61 62 6c 65 73 | 20 66 6f 6c 6c 6f 77 65 |ariables| followe|
|00000680| 64 20 62 79 20 61 20 73 | 70 61 63 65 2d 64 65 6c |d by a s|pace-del|
|00000690| 69 6d 69 74 65 64 20 70 | 65 72 69 6f 64 20 61 6e |imited p|eriod an|
|000006a0| 64 20 61 6e 6f 74 68 65 | 72 20 76 61 72 69 61 62 |d anothe|r variab|
|000006b0| 6c 65 20 28 61 73 0a 69 | 6e 20 61 20 6c 61 6d 62 |le (as.i|n a lamb|
|000006c0| 64 61 20 65 78 70 72 65 | 73 73 69 6f 6e 29 2e 20 |da expre|ssion). |
|000006d0| 20 54 68 69 73 20 66 6f | 72 6d 20 69 73 20 65 71 | This fo|rm is eq|
|000006e0| 75 69 76 61 6c 65 6e 74 | 20 74 6f 0a 5c 62 65 67 |uivalent| to.\beg|
|000006f0| 69 6e 7b 73 63 68 65 6d | 65 7d 0a 28 64 65 66 69 |in{schem|e}.(defi|
|00000700| 6e 65 20 5c 68 79 70 65 | 72 7b 76 61 72 69 61 62 |ne \hype|r{variab|
|00000710| 6c 65 7d 0a 20 20 28 6c | 61 6d 62 64 61 20 28 5c |le}. (l|ambda (\|
|00000720| 68 79 70 65 72 7b 66 6f | 72 6d 61 6c 73 7d 29 20 |hyper{fo|rmals}) |
|00000730| 5c 68 79 70 65 72 7b 62 | 6f 64 79 7d 29 29 5c 72 |\hyper{b|ody}))\r|
|00000740| 6d 2e 25 0a 5c 65 6e 64 | 7b 73 63 68 65 6d 65 7d |m.%.\end|{scheme}|
|00000750| 0a 0a 5c 69 74 65 6d 7b | 5c 74 74 28 64 65 66 69 |..\item{|\tt(defi|
|00000760| 6e 65 20 28 5c 68 79 70 | 65 72 7b 76 61 72 69 61 |ne (\hyp|er{varia|
|00000770| 62 6c 65 7d 20 2e 5c 20 | 5c 68 79 70 65 72 7b 66 |ble} .\ |\hyper{f|
|00000780| 6f 72 6d 61 6c 7d 29 20 | 5c 68 79 70 65 72 7b 62 |ormal}) |\hyper{b|
|00000790| 6f 64 79 7d 29 7d 0a 0a | 54 68 69 73 20 73 79 6e |ody})}..|This syn|
|000007a0| 74 61 78 20 69 73 20 6e | 6f 74 20 65 73 73 65 6e |tax is n|ot essen|
|000007b0| 74 69 61 6c 2e 20 20 5c | 68 79 70 65 72 7b 46 6f |tial. \|hyper{Fo|
|000007c0| 72 6d 61 6c 7d 20 73 68 | 6f 75 6c 64 20 62 65 20 |rmal} sh|ould be |
|000007d0| 61 20 73 69 6e 67 6c 65 | 0a 76 61 72 69 61 62 6c |a single|.variabl|
|000007e0| 65 2e 20 20 54 68 69 73 | 20 66 6f 72 6d 20 69 73 |e. This| form is|
|000007f0| 20 65 71 75 69 76 61 6c | 65 6e 74 20 74 6f 0a 5c | equival|ent to.\|
|00000800| 62 65 67 69 6e 7b 73 63 | 68 65 6d 65 7d 0a 28 64 |begin{sc|heme}.(d|
|00000810| 65 66 69 6e 65 20 5c 68 | 79 70 65 72 7b 76 61 72 |efine \h|yper{var|
|00000820| 69 61 62 6c 65 7d 0a 20 | 20 28 6c 61 6d 62 64 61 |iable}. | (lambda|
|00000830| 20 5c 68 79 70 65 72 7b | 66 6f 72 6d 61 6c 7d 20 | \hyper{|formal} |
|00000840| 5c 68 79 70 65 72 7b 62 | 6f 64 79 7d 29 29 5c 72 |\hyper{b|ody}))\r|
|00000850| 6d 2e 25 0a 5c 65 6e 64 | 7b 73 63 68 65 6d 65 7d |m.%.\end|{scheme}|
|00000860| 0a 0a 5c 69 74 65 6d 20 | 7b 5c 74 74 28 62 65 67 |..\item |{\tt(beg|
|00000870| 69 6e 20 5c 68 79 70 65 | 72 69 7b 64 65 66 69 6e |in \hype|ri{defin|
|00000880| 69 74 69 6f 6e 7d 20 5c | 64 6f 74 73 66 6f 6f 29 |ition} \|dotsfoo)|
|00000890| 7d 0a 0a 54 68 69 73 20 | 73 79 6e 74 61 78 20 69 |}..This |syntax i|
|000008a0| 73 20 65 73 73 65 6e 74 | 69 61 6c 2e 20 20 54 68 |s essent|ial. Th|
|000008b0| 69 73 20 66 6f 72 6d 20 | 69 73 20 65 71 75 69 76 |is form |is equiv|
|000008c0| 61 6c 65 6e 74 20 74 6f | 20 74 68 65 20 73 65 74 |alent to| the set|
|000008d0| 20 6f 66 0a 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 | of.defi|nitions |
|000008e0| 74 68 61 74 20 66 6f 72 | 6d 20 74 68 65 20 62 6f |that for|m the bo|
|000008f0| 64 79 20 6f 66 20 74 68 | 65 20 5c 69 64 65 7b 62 |dy of th|e \ide{b|
|00000900| 65 67 69 6e 7d 2e 0a 0a | 5c 65 6e 64 7b 69 74 65 |egin}...|\end{ite|
|00000910| 6d 69 7a 65 7d 0a 0a 0a | 5c 73 75 62 73 65 63 74 |mize}...|\subsect|
|00000920| 69 6f 6e 7b 54 6f 70 20 | 6c 65 76 65 6c 20 64 65 |ion{Top |level de|
|00000930| 66 69 6e 69 74 69 6f 6e | 73 7d 0a 0a 41 74 20 74 |finition|s}..At t|
|00000940| 68 65 20 74 6f 70 20 6c | 65 76 65 6c 20 6f 66 20 |he top l|evel of |
|00000950| 61 20 70 72 6f 67 72 61 | 6d 2c 20 61 20 64 65 66 |a progra|m, a def|
|00000960| 69 6e 69 74 69 6f 6e 0a | 5c 62 65 67 69 6e 7b 73 |inition.|\begin{s|
|00000970| 63 68 65 6d 65 7d 0a 28 | 64 65 66 69 6e 65 20 5c |cheme}.(|define \|
|00000980| 68 79 70 65 72 7b 76 61 | 72 69 61 62 6c 65 7d 20 |hyper{va|riable} |
|00000990| 5c 68 79 70 65 72 7b 65 | 78 70 72 65 73 73 69 6f |\hyper{e|xpressio|
|000009a0| 6e 7d 29 25 0a 5c 65 6e | 64 7b 73 63 68 65 6d 65 |n})%.\en|d{scheme|
|000009b0| 7d 0a 68 61 73 20 65 73 | 73 65 6e 74 69 61 6c 6c |}.has es|sentiall|
|000009c0| 79 20 74 68 65 20 73 61 | 6d 65 20 65 66 66 65 63 |y the sa|me effec|
|000009d0| 74 20 61 73 20 74 68 65 | 20 61 73 73 69 67 6e 6d |t as the| assignm|
|000009e0| 65 6e 74 20 65 78 70 72 | 65 73 73 69 6f 6e 0a 5c |ent expr|ession.\|
|000009f0| 62 65 67 69 6e 7b 73 63 | 68 65 6d 65 7d 0a 28 5c |begin{sc|heme}.(\|
|00000a00| 69 64 65 7b 73 65 74 21 | 7d 5c 20 5c 68 79 70 65 |ide{set!|}\ \hype|
|00000a10| 72 7b 76 61 72 69 61 62 | 6c 65 7d 20 5c 68 79 70 |r{variab|le} \hyp|
|00000a20| 65 72 7b 65 78 70 72 65 | 73 73 69 6f 6e 7d 29 25 |er{expre|ssion})%|
|00000a30| 0a 5c 65 6e 64 7b 73 63 | 68 65 6d 65 7d 0a 69 66 |.\end{sc|heme}.if|
|00000a40| 20 5c 68 79 70 65 72 7b | 76 61 72 69 61 62 6c 65 | \hyper{|variable|
|00000a50| 7d 20 69 73 20 62 6f 75 | 6e 64 2e 20 20 49 66 20 |} is bou|nd. If |
|00000a60| 5c 68 79 70 65 72 7b 76 | 61 72 69 61 62 6c 65 7d |\hyper{v|ariable}|
|00000a70| 20 69 73 20 6e 6f 74 20 | 62 6f 75 6e 64 2c 0a 68 | is not |bound,.h|
|00000a80| 6f 77 65 76 65 72 2c 20 | 74 68 65 6e 20 74 68 65 |owever, |then the|
|00000a90| 20 64 65 66 69 6e 69 74 | 69 6f 6e 20 77 69 6c 6c | definit|ion will|
|00000aa0| 20 62 69 6e 64 20 5c 68 | 79 70 65 72 7b 76 61 72 | bind \h|yper{var|
|00000ab0| 69 61 62 6c 65 7d 20 74 | 6f 20 61 20 6e 65 77 0a |iable} t|o a new.|
|00000ac0| 6c 6f 63 61 74 69 6f 6e | 20 62 65 66 6f 72 65 20 |location| before |
|00000ad0| 70 65 72 66 6f 72 6d 69 | 6e 67 20 74 68 65 20 61 |performi|ng the a|
|00000ae0| 73 73 69 67 6e 6d 65 6e | 74 2c 20 77 68 65 72 65 |ssignmen|t, where|
|00000af0| 61 73 20 69 74 20 77 6f | 75 6c 64 20 62 65 20 61 |as it wo|uld be a|
|00000b00| 6e 20 65 72 72 6f 72 0a | 74 6f 20 70 65 72 66 6f |n error.|to perfo|
|00000b10| 72 6d 20 61 20 5c 69 64 | 65 7b 73 65 74 21 7d 5c |rm a \id|e{set!}\|
|00000b20| 20 6f 6e 20 61 6e 20 75 | 6e 62 6f 75 6e 64 5c 69 | on an u|nbound\i|
|00000b30| 6e 64 65 78 7b 75 6e 62 | 6f 75 6e 64 7d 20 76 61 |ndex{unb|ound} va|
|00000b40| 72 69 61 62 6c 65 2e 0a | 0a 5c 62 65 67 69 6e 7b |riable..|.\begin{|
|00000b50| 73 63 68 65 6d 65 7d 0a | 28 64 65 66 69 6e 65 20 |scheme}.|(define |
|00000b60| 61 64 64 33 0a 20 20 28 | 6c 61 6d 62 64 61 20 28 |add3. (|lambda (|
|00000b70| 78 29 20 28 2b 20 78 20 | 33 29 29 29 0a 28 61 64 |x) (+ x |3))).(ad|
|00000b80| 64 33 20 33 29 20 20 20 | 20 20 20 20 20 20 20 20 |d3 3) | |
|00000b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ba0| 20 5c 65 76 20 20 36 0a | 28 64 65 66 69 6e 65 20 | \ev 6.|(define |
|00000bb0| 66 69 72 73 74 20 63 61 | 72 29 0a 28 66 69 72 73 |first ca|r).(firs|
|00000bc0| 74 20 27 28 31 20 32 29 | 29 20 20 20 20 20 20 20 |t '(1 2)|) |
|00000bd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 5c | | \|
|00000be0| 65 76 20 20 31 25 0a 5c | 65 6e 64 7b 73 63 68 65 |ev 1%.\|end{sche|
|00000bf0| 6d 65 7d 0a 0a 41 6c 6c | 20 53 63 68 65 6d 65 20 |me}..All| Scheme |
|00000c00| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 73 20 |implemen|tations |
|00000c10| 6d 75 73 74 20 73 75 70 | 70 6f 72 74 20 74 6f 70 |must sup|port top|
|00000c20| 20 6c 65 76 65 6c 20 64 | 65 66 69 6e 69 74 69 6f | level d|efinitio|
|00000c30| 6e 73 2e 0a 0a 53 6f 6d | 65 20 69 6d 70 6c 65 6d |ns...Som|e implem|
|00000c40| 65 6e 74 61 74 69 6f 6e | 73 20 6f 66 20 53 63 68 |entation|s of Sch|
|00000c50| 65 6d 65 20 75 73 65 20 | 61 6e 20 69 6e 69 74 69 |eme use |an initi|
|00000c60| 61 6c 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 69 |al envir|onment i|
|00000c70| 6e 0a 77 68 69 63 68 20 | 61 6c 6c 20 70 6f 73 73 |n.which |all poss|
|00000c80| 69 62 6c 65 20 76 61 72 | 69 61 62 6c 65 73 20 61 |ible var|iables a|
|00000c90| 72 65 20 62 6f 75 6e 64 | 20 74 6f 20 6c 6f 63 61 |re bound| to loca|
|00000ca0| 74 69 6f 6e 73 2c 20 6d | 6f 73 74 20 6f 66 0a 77 |tions, m|ost of.w|
|00000cb0| 68 69 63 68 20 63 6f 6e | 74 61 69 6e 20 75 6e 64 |hich con|tain und|
|00000cc0| 65 66 69 6e 65 64 20 76 | 61 6c 75 65 73 2e 20 20 |efined v|alues. |
|00000cd0| 54 6f 70 20 6c 65 76 65 | 6c 20 64 65 66 69 6e 69 |Top leve|l defini|
|00000ce0| 74 69 6f 6e 73 20 69 6e | 0a 73 75 63 68 20 61 6e |tions in|.such an|
|00000cf0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|00000d00| 61 72 65 20 74 72 75 6c | 79 20 65 71 75 69 76 61 |are trul|y equiva|
|00000d10| 6c 65 6e 74 20 74 6f 20 | 61 73 73 69 67 6e 6d 65 |lent to |assignme|
|00000d20| 6e 74 73 2e 0a 0a 5c 74 | 6f 64 6f 7b 52 6f 7a 61 |nts...\t|odo{Roza|
|00000d30| 73 3a 20 65 71 75 61 6c | 20 74 69 6d 65 20 66 6f |s: equal| time fo|
|00000d40| 72 20 6f 70 70 6f 73 69 | 74 69 6f 6e 20 73 65 6d |r opposi|tion sem|
|00000d50| 61 6e 74 69 63 73 3f 7d | 0a 0a 0a 5c 73 75 62 73 |antics?}|...\subs|
|00000d60| 65 63 74 69 6f 6e 7b 49 | 6e 74 65 72 6e 61 6c 20 |ection{I|nternal |
|00000d70| 64 65 66 69 6e 69 74 69 | 6f 6e 73 7d 0a 5c 6c 61 |definiti|ons}.\la|
|00000d80| 62 65 6c 7b 69 6e 74 65 | 72 6e 61 6c 64 65 66 69 |bel{inte|rnaldefi|
|00000d90| 6e 65 73 7d 0a 0a 53 6f | 6d 65 20 69 6d 70 6c 65 |nes}..So|me imple|
|00000da0| 6d 65 6e 74 61 74 69 6f | 6e 73 20 6f 66 20 53 63 |mentatio|ns of Sc|
|00000db0| 68 65 6d 65 20 70 65 72 | 6d 69 74 20 64 65 66 69 |heme per|mit defi|
|00000dc0| 6e 69 74 69 6f 6e 73 20 | 74 6f 20 6f 63 63 75 72 |nitions |to occur|
|00000dd0| 20 61 74 20 74 68 65 0a | 62 65 67 69 6e 6e 69 6e | at the.|beginnin|
|00000de0| 67 20 6f 66 20 61 20 5c | 68 79 70 65 72 7b 62 6f |g of a \|hyper{bo|
|00000df0| 64 79 7d 20 28 74 68 61 | 74 20 69 73 2c 20 74 68 |dy} (tha|t is, th|
|00000e00| 65 20 62 6f 64 79 20 6f | 66 20 61 20 5c 69 64 65 |e body o|f a \ide|
|00000e10| 7b 6c 61 6d 62 64 61 7d | 2c 0a 5c 69 64 65 7b 6c |{lambda}|,.\ide{l|
|00000e20| 65 74 7d 2c 20 5c 69 64 | 65 7b 6c 65 74 2a 7d 2c |et}, \id|e{let*},|
|00000e30| 20 5c 69 64 65 7b 6c 65 | 74 72 65 63 7d 2c 20 6f | \ide{le|trec}, o|
|00000e40| 72 20 5c 69 64 65 7b 64 | 65 66 69 6e 65 7d 20 65 |r \ide{d|efine} e|
|00000e50| 78 70 72 65 73 73 69 6f | 6e 29 2e 20 20 53 75 63 |xpressio|n). Suc|
|00000e60| 68 0a 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 61 72 |h.defini|tions ar|
|00000e70| 65 20 6b 6e 6f 77 6e 20 | 61 73 20 7b 5c 65 6d 20 |e known |as {\em |
|00000e80| 69 6e 74 65 72 6e 61 6c | 20 64 65 66 69 6e 69 74 |internal| definit|
|00000e90| 69 6f 6e 73 7d 20 5c 6d | 61 69 6e 69 6e 64 65 78 |ions} \m|ainindex|
|00000ea0| 7b 69 6e 74 65 72 6e 61 | 6c 0a 64 65 66 69 6e 69 |{interna|l.defini|
|00000eb0| 74 69 6f 6e 7d 20 61 73 | 20 6f 70 70 6f 73 65 64 |tion} as| opposed|
|00000ec0| 20 74 6f 20 74 68 65 20 | 74 6f 70 20 6c 65 76 65 | to the |top leve|
|00000ed0| 6c 20 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 64 65 |l defini|tions de|
|00000ee0| 73 63 72 69 62 65 64 20 | 61 62 6f 76 65 2e 0a 54 |scribed |above..T|
|00000ef0| 68 65 20 76 61 72 69 61 | 62 6c 65 20 64 65 66 69 |he varia|ble defi|
|00000f00| 6e 65 64 20 62 79 20 61 | 6e 20 69 6e 74 65 72 6e |ned by a|n intern|
|00000f10| 61 6c 20 64 65 66 69 6e | 69 74 69 6f 6e 20 69 73 |al defin|ition is|
|00000f20| 20 6c 6f 63 61 6c 20 74 | 6f 20 74 68 65 0a 5c 68 | local t|o the.\h|
|00000f30| 79 70 65 72 7b 62 6f 64 | 79 7d 2e 20 20 54 68 61 |yper{bod|y}. Tha|
|00000f40| 74 20 69 73 2c 20 5c 68 | 79 70 65 72 7b 76 61 72 |t is, \h|yper{var|
|00000f50| 69 61 62 6c 65 7d 20 69 | 73 20 62 6f 75 6e 64 20 |iable} i|s bound |
|00000f60| 72 61 74 68 65 72 20 74 | 68 61 6e 20 61 73 73 69 |rather t|han assi|
|00000f70| 67 6e 65 64 2c 0a 61 6e | 64 20 74 68 65 20 72 65 |gned,.an|d the re|
|00000f80| 67 69 6f 6e 20 6f 66 20 | 74 68 65 20 62 69 6e 64 |gion of |the bind|
|00000f90| 69 6e 67 20 69 73 20 74 | 68 65 20 65 6e 74 69 72 |ing is t|he entir|
|00000fa0| 65 20 5c 68 79 70 65 72 | 7b 62 6f 64 79 7d 2e 20 |e \hyper|{body}. |
|00000fb0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 0a 0a 5c | For exa|mple,..\|
|00000fc0| 62 65 67 69 6e 7b 73 63 | 68 65 6d 65 7d 0a 28 6c |begin{sc|heme}.(l|
|00000fd0| 65 74 20 28 28 78 20 35 | 29 29 0a 20 20 28 64 65 |et ((x 5|)). (de|
|00000fe0| 66 69 6e 65 20 66 6f 6f | 20 28 6c 61 6d 62 64 61 |fine foo| (lambda|
|00000ff0| 20 28 79 29 20 28 62 61 | 72 20 78 20 79 29 29 29 | (y) (ba|r x y)))|
|00001000| 0a 20 20 28 64 65 66 69 | 6e 65 20 62 61 72 20 28 |. (defi|ne bar (|
|00001010| 6c 61 6d 62 64 61 20 28 | 61 20 62 29 20 28 2b 20 |lambda (|a b) (+ |
|00001020| 28 2a 20 61 20 62 29 20 | 61 29 29 29 0a 20 20 28 |(* a b) |a))). (|
|00001030| 66 6f 6f 20 28 2b 20 78 | 20 33 29 29 29 20 20 20 |foo (+ x| 3))) |
|00001040| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 65 76 | | \ev|
|00001050| 20 20 34 35 25 0a 5c 65 | 6e 64 7b 73 63 68 65 6d | 45%.\e|nd{schem|
|00001060| 65 7d 0a 0a 41 20 5c 68 | 79 70 65 72 7b 62 6f 64 |e}..A \h|yper{bod|
|00001070| 79 7d 20 63 6f 6e 74 61 | 69 6e 69 6e 67 20 69 6e |y} conta|ining in|
|00001080| 74 65 72 6e 61 6c 20 64 | 65 66 69 6e 69 74 69 6f |ternal d|efinitio|
|00001090| 6e 73 20 63 61 6e 20 61 | 6c 77 61 79 73 20 62 65 |ns can a|lways be|
|000010a0| 20 63 6f 6e 76 65 72 74 | 65 64 0a 69 6e 74 6f 20 | convert|ed.into |
|000010b0| 61 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 65 71 75 |a comple|tely equ|
|000010c0| 69 76 61 6c 65 6e 74 20 | 5c 69 64 65 7b 6c 65 74 |ivalent |\ide{let|
|000010d0| 72 65 63 7d 20 65 78 70 | 72 65 73 73 69 6f 6e 2e |rec} exp|ression.|
|000010e0| 20 20 46 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 74 | For ex|ample, t|
|000010f0| 68 65 0a 5c 69 64 65 7b | 6c 65 74 7d 20 65 78 70 |he.\ide{|let} exp|
|00001100| 72 65 73 73 69 6f 6e 20 | 69 6e 20 74 68 65 20 61 |ression |in the a|
|00001110| 62 6f 76 65 20 65 78 61 | 6d 70 6c 65 20 69 73 20 |bove exa|mple is |
|00001120| 65 71 75 69 76 61 6c 65 | 6e 74 20 74 6f 0a 0a 5c |equivale|nt to..\|
|00001130| 62 65 67 69 6e 7b 73 63 | 68 65 6d 65 7d 0a 28 6c |begin{sc|heme}.(l|
|00001140| 65 74 20 28 28 78 20 35 | 29 29 0a 20 20 28 6c 65 |et ((x 5|)). (le|
|00001150| 74 72 65 63 20 28 28 66 | 6f 6f 20 28 6c 61 6d 62 |trec ((f|oo (lamb|
|00001160| 64 61 20 28 79 29 20 28 | 62 61 72 20 78 20 79 29 |da (y) (|bar x y)|
|00001170| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 28 62 |)). | (b|
|00001180| 61 72 20 28 6c 61 6d 62 | 64 61 20 28 61 20 62 29 |ar (lamb|da (a b)|
|00001190| 20 28 2b 20 28 2a 20 61 | 20 62 29 20 61 29 29 29 | (+ (* a| b) a)))|
|000011a0| 29 0a 20 20 20 20 28 66 | 6f 6f 20 28 2b 20 78 20 |). (f|oo (+ x |
|000011b0| 33 29 29 29 29 25 0a 5c | 65 6e 64 7b 73 63 68 65 |3))))%.\|end{sche|
|000011c0| 6d 65 7d 0a 0a 4a 75 73 | 74 20 61 73 20 66 6f 72 |me}..Jus|t as for|
|000011d0| 20 74 68 65 20 65 71 75 | 69 76 61 6c 65 6e 74 20 | the equ|ivalent |
|000011e0| 5c 69 64 65 7b 6c 65 74 | 72 65 63 7d 20 65 78 70 |\ide{let|rec} exp|
|000011f0| 72 65 73 73 69 6f 6e 2c | 20 69 74 20 6d 75 73 74 |ression,| it must|
|00001200| 20 62 65 0a 70 6f 73 73 | 69 62 6c 65 20 74 6f 20 | be.poss|ible to |
|00001210| 65 76 61 6c 75 61 74 65 | 20 65 61 63 68 20 5c 68 |evaluate| each \h|
|00001220| 79 70 65 72 7b 65 78 70 | 72 65 73 73 69 6f 6e 7d |yper{exp|ression}|
|00001230| 20 6f 66 20 65 76 65 72 | 79 20 69 6e 74 65 72 6e | of ever|y intern|
|00001240| 61 6c 0a 64 65 66 69 6e | 69 74 69 6f 6e 20 69 6e |al.defin|ition in|
|00001250| 20 61 20 5c 68 79 70 65 | 72 7b 62 6f 64 79 7d 20 | a \hype|r{body} |
|00001260| 77 69 74 68 6f 75 74 20 | 61 73 73 69 67 6e 69 6e |without |assignin|
|00001270| 67 20 6f 72 20 72 65 66 | 65 72 72 69 6e 67 20 74 |g or ref|erring t|
|00001280| 6f 0a 74 68 65 20 76 61 | 6c 75 65 20 6f 66 20 61 |o.the va|lue of a|
|00001290| 6e 79 20 5c 68 79 70 65 | 72 7b 76 61 72 69 61 62 |ny \hype|r{variab|
|000012a0| 6c 65 7d 20 62 65 69 6e | 67 20 64 65 66 69 6e 65 |le} bein|g define|
|000012b0| 64 2e 0a | |d.. | |
+--------+-------------------------+-------------------------+--------+--------+